package cn.yaboya.feign;


import cn.yaboya.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: Eric
 * @CreateTime: 2022-07-28  16:50
 * @Description: TODO
 */

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        return id -> {
            throwable.printStackTrace();
            return User.builder().desc("江恩了个鸡").build();
        };
    }


    //@Override
    //public UserFeignClient create(Throwable throwable) {
    //    return new UserFeignClient() {
    //        @Override
    //        public User getUserById(Long id) {
    //            throwable.printStackTrace();
    //            return User.builder().intro("江恩了个鸡").build();
    //        }
    //    };
    //}
}
